package com.lsa.helpers;

import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import java.util.ListIterator;

import sun.reflect.generics.reflectiveObjects.NotImplementedException;

public class ListArray<E> implements List<E>
{
	private E[] array;
	
	public ListArray(E[] array)
	{
		super();
		this.array = array;
	}
	
	public ListArray()
	{
		
	}

	@Override
	public boolean add(E e)
	{
		throw new NotImplementedException();
	}

	@Override
	public void add(int index, E element)
	{
		throw new NotImplementedException();
	}

	@Override
	public boolean addAll(Collection<? extends E> c)
	{
		throw new NotImplementedException();
	}

	@Override
	public boolean addAll(int index, Collection<? extends E> c)
	{
		throw new NotImplementedException();
	}

	@Override
	public void clear()
	{
		throw new NotImplementedException();
	}

	@Override
	public boolean contains(Object o)
	{
		boolean isContains = false;
		
		for (int i = 0; i < array.length; i++)
		{
			if (array[i].equals(o))
			{
				isContains = true;
				break;
			}
		}
		
		return isContains;
	}

	@Override
	public boolean containsAll(Collection<?> c)
	{
		throw new NotImplementedException();
	}

	@Override
	public E get(int index)
	{
		return array[index];
	}

	@Override
	public int indexOf(Object o)
	{
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public boolean isEmpty()
	{
		// TODO Auto-generated method stub
		return false;
	}

	@Override
	public Iterator<E> iterator()
	{
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public int lastIndexOf(Object o)
	{
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public ListIterator<E> listIterator()
	{
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public ListIterator<E> listIterator(int index)
	{
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public boolean remove(Object o)
	{
		// TODO Auto-generated method stub
		return false;
	}

	@Override
	public E remove(int index)
	{
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public boolean removeAll(Collection<?> c)
	{
		// TODO Auto-generated method stub
		return false;
	}

	@Override
	public boolean retainAll(Collection<?> c)
	{
		// TODO Auto-generated method stub
		return false;
	}

	@Override
	public E set(int index, E element)
	{
		array[index] = element;
		return element;
	}

	@Override
	public int size()
	{
		return array.length;
	}

	@Override
	public List<E> subList(int fromIndex, int toIndex)
	{
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public Object[] toArray()
	{
		return null;
	}

	@Override
	public <T> T[] toArray(T[] a)
	{
		if (a == null || a.length < this.array.length)
		{
			return (T[])this.array;
		}
		
		System.arraycopy(this.array, 0, a, 0, this.array.length);
		return a;
	}
}
